﻿
CREATE PROCEDURE [dbo].[OPM_ReturnOrderStatus_GetList]
(
	@ShowHidden  bit = 0,
	@ShowDeleted bit = 0
)

AS

	SELECT 		
		s.[Id],
		s.[Name],
		s.[Description],
		s.[DisplayOrder],
		s.[Published],
		s.[Deleted],
		s.[CreatedBy],
		s.[UpdatedBy],
		s.[CreatedOn],
		s.[UpdatedOn]
	    FROM dbo.[OPM_ReturnOrderStatus] s
        
        WHERE 
	    (s.Published = 1 OR @ShowHidden = 1) 
	    -- IF Show Hidden is true, then all records would be shown
	    -- IF Show Published, then display all records filter by t.Published = 1
	    AND    
	    (s.Deleted = 0 OR @ShowDeleted = 1)     
	    -- IF Show Deleted is true,  then all records would be shown
	    -- IF Show Deleted is false, then display all records filter by t.Deleted = 0
        
		ORDER BY s.DisplayOrder ASC